package com.quarkus.mybatis.controller;

import com.quarkus.mybatis.entity.User;
import com.quarkus.mybatis.mapper.UserMapper;

import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Path("/users")
public class UserController {

    @Inject
    UserMapper userMapper;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<User> getUsers() {
        return userMapper.findAllUsers();
    }

    @Path("/list")
    @GET
    public List<User> getList(){
        return userMapper.findAllUsersUsingBuilder();
    }


    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/builder")
    public List<User> getUsersUsingSqlBuilder() {
        return userMapper.findAllUsersUsingBuilder();
    }


    @GET
    @Path("/all")
    @Produces(MediaType.APPLICATION_JSON)
    public List<User> findList(){
        return userMapper.findAll();
    }
}
